//引入react jsx写法的必须
import React from "react";
//引入需要用到的页面组件

import App from "../App";
import Login from "../components/Login";
import Adminhome from "../adminhome";
import Home from "../pages/Home";
import Userlist from "../pages/Userlist";
import Loanmoneylist from "../pages/Loanmoneylist";
import Loanmoneydetail from "../pages/Loanmoneydetail";
import NotFound from "../components/404/";
//引入一些模块
import { BrowserRouter, Route, Switch } from "react-router-dom";

function router() {
  return (
    <BrowserRouter>
      <App>
        <Switch>
          <Route path="/login" component={Login} />
          <Route
            path="/admin"
            render={() => {
              return <Adminhome>
                  <Route path="/admin/home" component={Home} />
                  <Route path="/admin/userlist" component={Userlist} />
                  <Route path="/admin/loanmoneylist" component={Loanmoneylist} />
                  <Route path="/admin/loanmoneydetail" component={Loanmoneydetail} />
                  <Route component={NotFound} />
              </Adminhome>;
            }}
          />
          <Route component={NotFound} />
          
        </Switch>
      </App>
    </BrowserRouter>
  );
}

export default router;
